# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=0d1n
_pkgname="CoolerVoid_$pkgname"
pkgver=263.2d723ae
pkgrel=2
epoch=1
groups=('blackarch' 'blackarch-webapp' 'blackarch-fuzzer' 'blackarch-scanner')
pkgdesc='Web security tool to make fuzzing at HTTP inputs, made in C with libCurl.'
arch=('x86_64' 'aarch64')
url='https://github.com/CoolerVoid/0d1n'
license=('GPL3')
depends=('curl')
makedepends=('git')
source=("git+https://github.com/tadryanom/$_pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $_pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd $_pkgname

  make

  cd 0d1n_viewer

  make
}

package() {
  cd $_pkgname

  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 755 "bin/$pkgname" "$pkgdir/usr/bin/$pkgname"
  install -Dm 755 "0d1n_viewer/bin/0d1n_view" "$pkgdir/usr/bin/0d1n_view"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  cp -a doc/* "$pkgdir/usr/share/doc/$pkgname/"

  rm -rf src/ *.o bin/ doc *.txt *.md

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname/"
}

